package com.nt.test.mapper;

import com.nt.test.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Insert("insert into user(username,password) values (#{username,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR})")
    int insertUser(User user);

    @Select("select * from user where username=#{username} and password=#{password}")
    @Results({
            @Result(column = "uid",property = "uid"),
            @Result(column = "username",property = "username"),
            @Result(column = "password",property = "password"),
    })
    User selectUser(User user);

    @Select("select * from user where username = #{username}")
    @Results({
            @Result(column = "uid",property = "uid"),
            @Result(column = "username",property = "username"),
            @Result(column = "password",property = "password"),
    })
    List<User> findByUsername(String username);
}
